package structure.Proxy;

/**
 * Created by LYJ on 2016/10/19.
 * 代理主题角色
 * 静态代理
 */
public class Proxys implements Subject{

    private Subject subject=null;

    //通过代理对象去实例化具体对象并调用其方法
    @Override
    public void operate() {
        if (null==subject){
            subject=new RealSubject();
        }
        System.out.println("我是代理，I'm invoking...");
        this.subject.operate();
    }
}
